package com.sync.utils.project.demo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

/**
 * TODO
 *
 * @Author YWF
 * @Date 2023/6/9 11:08
 */
@Slf4j
public class MineExecutorsFactory {

    private final static String mineName = "自定义线程_";

    public final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, new ThreadFactory() {
        int numThreads = 1;
        @Override
        public Thread newThread(Runnable r) {
            return new Thread(r,mineName + numThreads++);
        }
    });

}

